home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 August: Technology Seed / August 1998 ADC Seed CD.toast / Mac OS 8.5b2 / allegro-b2-pseudo-SDK / CIncludes / MacWindows.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-07-17  |  56.4 KB  |  1,569 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        MacWindows.h
  3.  
  4.      Contains:    Window Manager Interfaces.
  5.  
  6.      Version:    Technology:    Mac OS 8.1
  7.                  Release:    Allego Seed, Use with 3.1 Universal Interfaces
  8.  
  9.      Copyright:    © 1997-1998 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __MACWINDOWS__
  19. #define __MACWINDOWS__
  20.  
  21. #ifndef __MACTYPES__
  22. #include <MacTypes.h>
  23. #endif
  24. #ifndef __ALIASES__
  25. #include <Aliases.h>
  26. #endif
  27. #ifndef __APPLEEVENTS__
  28. #include <AppleEvents.h>
  29. #endif
  30. #ifndef __COLLECTIONS__
  31. #include <Collections.h>
  32. #endif
  33. #ifndef __DRAG__
  34. #include <Drag.h>
  35. #endif
  36. #ifndef __EVENTS__
  37. #include <Events.h>
  38. #endif
  39. #ifndef __MENUS__
  40. #include <Menus.h>
  41. #endif
  42. #ifndef __MIXEDMODE__
  43. #include <MixedMode.h>
  44. #endif
  45. #ifndef __QDOFFSCREEN__
  46. #include <QDOffscreen.h>
  47. #endif
  48. #ifndef __QUICKDRAW__
  49. #include <Quickdraw.h>
  50. #endif
  51. #ifndef __TEXTCOMMON__
  52. #include <TextCommon.h>
  53. #endif
  54.  
  55. #ifndef __ICONSERVICES__
  56. #include <IconServices.h>
  57. #endif
  58.  
  59.  
  60. #if PRAGMA_ONCE
  61. #pragma once
  62. #endif
  63.  
  64. #ifdef __cplusplus
  65. extern "C" {
  66. #endif
  67.  
  68. #if PRAGMA_IMPORT
  69. #pragma import on
  70. #endif
  71.  
  72. #if PRAGMA_STRUCT_ALIGN
  73.     #pragma options align=mac68k
  74. #elif PRAGMA_STRUCT_PACKPUSH
  75.     #pragma pack(push, 2)
  76. #elif PRAGMA_STRUCT_PACK
  77.     #pragma pack(2)
  78. #endif
  79.  
  80. /*——————————————————————————————————————————————————————————————————————————————————————*/
  81. /* • Property Types                                                                        */
  82. /*——————————————————————————————————————————————————————————————————————————————————————*/
  83. typedef OSType                             PropertyCreator;
  84. typedef OSType                             PropertyTag;
  85. /*——————————————————————————————————————————————————————————————————————————————————————*/
  86. /* • Window Classes                                                                        */
  87. /*——————————————————————————————————————————————————————————————————————————————————————*/
  88. typedef UInt32                             WindowClass;
  89.  
  90. enum {
  91.     kAlertWindowClass            = 1L,                            /* “I need your attention now.”*/
  92.     kMovableAlertWindowClass    = 2L,                            /* “I need your attention now, and I’m kind enough to let you switch out of this app to do other things.”*/
  93.     kModalWindowClass            = 3L,                            /* system modal, not draggable*/
  94.     kMovableModalWindowClass    = 4L,                            /* application modal, draggable*/
  95.     kFloatingWindowClass        = 5L,                            /* floats above all other application windows*/
  96.     kDocumentWindowClass        = 6L                            /* everything else*/
  97. };
  98.  
  99.  
  100. /*——————————————————————————————————————————————————————————————————————————————————————*/
  101. /* • Window Attributes                                                                    */
  102. /*——————————————————————————————————————————————————————————————————————————————————————*/
  103.  
  104. typedef UInt32                             WindowAttributes;
  105.  
  106. enum {
  107.     kWindowNoAttributes            = 0L,                            /* no attributes*/
  108.     kWindowCloseBoxAttribute    = (1L << 0),                    /* window has a close box*/
  109.     kWindowHorizontalZoomAttribute = (1L << 1),                    /* window has horizontal zoom box*/
  110.     kWindowVerticalZoomAttribute = (1L << 2),                    /* window has vertical zoom box*/
  111.     kWindowFullZoomAttribute    = (kWindowVerticalZoomAttribute | kWindowHorizontalZoomAttribute),
  112.     kWindowCollapseBoxAttribute    = (1L << 3),                    /* window has a collapse box*/
  113.     kWindowResizableAttribute    = (1L << 4),                    /* window is resizable*/
  114.     kWindowSideTitlebarAttribute = (1L << 5),                    /* window wants a titlebar on the side    (floating window class only)*/
  115.     kWindowNoUpdatesAttribute    = (1L << 16),                    /* this window receives no update events*/
  116.     kWindowNoActivatesAttribute    = (1L << 17),                    /* this window receives no activate events*/
  117.     kWindowStandardDocumentAttributes = (kWindowCloseBoxAttribute | kWindowFullZoomAttribute | kWindowCollapseBoxAttribute | kWindowResizableAttribute),
  118.     kWindowStandardFloatingAttributes = (kWindowCloseBoxAttribute | kWindowCollapseBoxAttribute)
  119. };
  120.  
  121.  
  122. /*——————————————————————————————————————————————————————————————————————————————————————*/
  123. /* • Errors & Gestalt                                                                    */
  124. /*——————————————————————————————————————————————————————————————————————————————————————*/
  125.  
  126. enum {
  127.     gestaltWindowMgrAttr        = FOUR_CHAR_CODE('wind'),        /* If this Gestalt exists, the PowerPC-native Window Manager is installed*/
  128.     gestaltWindowMgrPresent        = (1L << 0)
  129. };
  130.  
  131.  
  132.  
  133. enum {
  134.     errInvalidWindowPtr            = -5600,                        /* tried to pass a bad WindowPtr argument*/
  135.     errUnsupportedWindowAttributesForClass = -5601,                /* tried to create a window with WindowAttributes not supported by the WindowClass*/
  136.     errWindowDoesNotHaveProxy    = -5602,                        /* tried to do something requiring a proxy to a window which doesn’t have a proxy*/
  137.     errInvalidWindowProperty    = -5603,                        /* tried to access a property tag with private creator*/
  138.     errWindowPropertyNotFound    = -5604,                        /* tried to get a nonexistent property*/
  139.     errUnrecognizedWindowClass    = -5605,                        /* tried to create a window with a bad WindowClass*/
  140.     errCorruptWindowDescription    = -5606,                        /* tried to load a corrupt window description (size or version fields incorrect)*/
  141.     errUserWantsToDragWindow    = -5607,                        /* if returned from TrackWindowProxyDrag, you should call DragWindow on the window*/
  142.     errWindowsAlreadyInitialized = -5608,                        /* tried to call InitFloatingWindows twice, or called InitWindows and then floating windows*/
  143.     errFloatingWindowsNotInitialized = -5609                    /* called HideFloatingWindows or ShowFloatingWindows without calling InitFloatingWindows*/
  144. };
  145.  
  146. /*——————————————————————————————————————————————————————————————————————————————————————*/
  147. /* • Window Definition Type                                                                */
  148. /*——————————————————————————————————————————————————————————————————————————————————————*/
  149.  
  150. enum {
  151.     kWindowDefProcType            = FOUR_CHAR_CODE('WDEF')
  152. };
  153.  
  154. /*——————————————————————————————————————————————————————————————————————————————————————*/
  155. /* • System 7.5 Window Definition Resource IDs                                            */
  156. /*——————————————————————————————————————————————————————————————————————————————————————*/
  157.  
  158. enum {
  159.     kStandardWindowDefinition    = 0,                            /* for document windows and dialogs*/
  160.     kRoundWindowDefinition        = 1,                            /* old da-style window*/
  161.     kFloatingWindowDefinition    = 124                            /* for floating windows*/
  162. };
  163.  
  164. /*——————————————————————————————————————————————————————————————————————————————————————*/
  165. /* • Variant Codes                                                                        */
  166. /*——————————————————————————————————————————————————————————————————————————————————————*/
  167.  
  168. enum {
  169.                                                                 /* for use with kStandardWindowDefinition */
  170.     kDocumentWindowVariantCode    = 0,
  171.     kModalDialogVariantCode        = 1,
  172.     kPlainDialogVariantCode        = 2,
  173.     kShadowDialogVariantCode    = 3,
  174.     kMovableModalDialogVariantCode = 5,
  175.     kAlertVariantCode            = 7,
  176.     kMovableAlertVariantCode    = 9,                            /* for use with kFloatingWindowDefinition */
  177.     kSideFloaterVariantCode        = 8
  178. };
  179.  
  180.  
  181. /*——————————————————————————————————————————————————————————————————————————————————————*/
  182. /* • DefProc IDs                                                                        */
  183. /*——————————————————————————————————————————————————————————————————————————————————————*/
  184.  
  185. enum {
  186.                                                                 /* classic ids */
  187.     documentProc                = 0,
  188.     dBoxProc                    = 1,
  189.     plainDBox                    = 2,
  190.     altDBoxProc                    = 3,
  191.     noGrowDocProc                = 4,
  192.     movableDBoxProc                = 5,
  193.     zoomDocProc                    = 8,
  194.     zoomNoGrow                    = 12,
  195.     rDocProc                    = 16,                            /* floating window defproc ids */
  196.     floatProc                    = 1985,
  197.     floatGrowProc                = 1987,
  198.     floatZoomProc                = 1989,
  199.     floatZoomGrowProc            = 1991,
  200.     floatSideProc                = 1993,
  201.     floatSideGrowProc            = 1995,
  202.     floatSideZoomProc            = 1997,
  203.     floatSideZoomGrowProc        = 1999
  204. };
  205.  
  206.  
  207. enum {
  208.                                                                 /* Resource IDs for theme-savvy window defprocs */
  209.     kWindowDocumentDefProcResID    = 64,
  210.     kWindowDialogDefProcResID    = 65,
  211.     kWindowUtilityDefProcResID    = 66,
  212.     kWindowUtilitySideTitleDefProcResID = 67
  213. };
  214.  
  215.  
  216. enum {
  217.                                                                 /* Proc IDs for theme-savvy windows */
  218.     kWindowDocumentProc            = 1024,
  219.     kWindowGrowDocumentProc        = 1025,
  220.     kWindowVertZoomDocumentProc    = 1026,
  221.     kWindowVertZoomGrowDocumentProc = 1027,
  222.     kWindowHorizZoomDocumentProc = 1028,
  223.     kWindowHorizZoomGrowDocumentProc = 1029,
  224.     kWindowFullZoomDocumentProc    = 1030,
  225.     kWindowFullZoomGrowDocumentProc = 1031
  226. };
  227.  
  228.  
  229. enum {
  230.                                                                 /* Proc IDs for theme-savvy dialogs */
  231.     kWindowPlainDialogProc        = 1040,
  232.     kWindowShadowDialogProc        = 1041,
  233.     kWindowModalDialogProc        = 1042,
  234.     kWindowMovableModalDialogProc = 1043,
  235.     kWindowAlertProc            = 1044,
  236.     kWindowMovableAlertProc        = 1045
  237. };
  238.  
  239.  
  240. enum {
  241.                                                                 /* procIDs available in Appearance 1.0.1 or later */
  242.     kWindowMovableModalGrowProc    = 1046
  243. };
  244.  
  245.  
  246. enum {
  247.                                                                 /* Proc IDs for top title bar theme-savvy floating windows */
  248.     kWindowFloatProc            = 1057,
  249.     kWindowFloatGrowProc        = 1059,
  250.     kWindowFloatVertZoomProc    = 1061,
  251.     kWindowFloatVertZoomGrowProc = 1063,
  252.     kWindowFloatHorizZoomProc    = 1065,
  253.     kWindowFloatHorizZoomGrowProc = 1067,
  254.     kWindowFloatFullZoomProc    = 1069,
  255.     kWindowFloatFullZoomGrowProc = 1071
  256. };
  257.  
  258.  
  259.  
  260. enum {
  261.                                                                 /* Proc IDs for side title bar theme-savvy floating windows */
  262.     kWindowFloatSideProc        = 1073,
  263.     kWindowFloatSideGrowProc    = 1075,
  264.     kWindowFloatSideVertZoomProc = 1077,
  265.     kWindowFloatSideVertZoomGrowProc = 1079,
  266.     kWindowFloatSideHorizZoomProc = 1081,
  267.     kWindowFloatSideHorizZoomGrowProc = 1083,
  268.     kWindowFloatSideFullZoomProc = 1085,
  269.     kWindowFloatSideFullZoomGrowProc = 1087
  270. };
  271.  
  272. /*——————————————————————————————————————————————————————————————————————————————————————*/
  273. /* • System 7 Window Positioning Constants                                                */
  274. /*                                                                                        */
  275. /* Passed into StandardAlert and used in ‘WIND’, ‘DLOG’, and ‘ALRT’ templates            */
  276. /* StandardAlert uses zero to specify the default position. Other calls use zero to        */
  277. /* specify “no position”.  Do not pass these constants to RepositionWindow.  Do not        */
  278. /* store these constants in the BasicWindowDescription of a ‘wind’ resource.            */
  279. /*——————————————————————————————————————————————————————————————————————————————————————*/
  280.  
  281.  
  282. enum {
  283.     kWindowNoPosition            = 0x0000,
  284.     kWindowDefaultPosition        = 0x0000,
  285.     kWindowCenterMainScreen        = 0x280A,
  286.     kWindowAlertPositionMainScreen = 0x300A,
  287.     kWindowStaggerMainScreen    = 0x380A,
  288.     kWindowCenterParentWindow    = 0xA80A,
  289.     kWindowAlertPositionParentWindow = 0xB00A,
  290.     kWindowStaggerParentWindow    = 0xB80A,
  291.     kWindowCenterParentWindowScreen = 0x680A,
  292.     kWindowAlertPositionParentWindowScreen = 0x700A,
  293.     kWindowStaggerParentWindowScreen = 0x780A
  294. };
  295.  
  296. /*——————————————————————————————————————————————————————————————————————————————————————*/
  297. /* • Window Positioning Methods                                                            */
  298. /*                                                                                        */
  299. /* Positioning methods passed to RepositionWindow.                                        */
  300. /* Do not use them in WIND, ALRT, DLOG templates.                                          */
  301. /* Do not confuse these constants with the constants above                                */
  302. /*——————————————————————————————————————————————————————————————————————————————————————*/
  303. typedef UInt32                             WindowPositionMethod;
  304.  
  305. enum {
  306.     kWindowCenterOnMainScreen    = 0x00000001,
  307.     kWindowCenterOnParentWindow    = 0x00000002,
  308.     kWindowCenterOnParentWindowScreen = 0x00000003,
  309.     kWindowCascadeOnMainScreen    = 0x00000004,
  310.     kWindowCascadeOnParentWindow = 0x00000005,
  311.     kWIndowCascadeOnParentWindowScreen = 0x00000006,
  312.     kWindowAlertPositionOnMainScreen = 0x00000007,
  313.     kWindowAlertPositionOnParentWindow = 0x00000008,
  314.     kWindowAlertPositionOnParentWindowScreen = 0x00000009
  315. };
  316.  
  317. /*——————————————————————————————————————————————————————————————————————————————————————*/
  318. /* • GetWindowRegion Types                                                                */
  319. /*——————————————————————————————————————————————————————————————————————————————————————*/
  320.  
  321.  
  322. enum {
  323.                                                                 /* Region values to pass into GetWindowRegion */
  324.     kWindowTitleBarRgn            = 0,
  325.     kWindowTitleTextRgn            = 1,
  326.     kWindowCloseBoxRgn            = 2,
  327.     kWindowZoomBoxRgn            = 3,
  328.     kWindowDragRgn                = 5,
  329.     kWindowGrowRgn                = 6,
  330.     kWindowCollapseBoxRgn        = 7,
  331.     kWindowStructureRgn            = 32,
  332.     kWindowContentRgn            = 33
  333. };
  334.  
  335.  
  336. enum {
  337.     kWindowTitleProxyIconRgn    = 8
  338. };
  339.  
  340. typedef UInt16                             WindowRegionCode;
  341. /* GetWindowRegionRec - a pointer to this is passed in WDEF param for kWindowMsgGetRegion*/
  342.  
  343. struct GetWindowRegionRec {
  344.     RgnHandle                         winRgn;
  345.     WindowRegionCode                 regionCode;
  346. };
  347. typedef struct GetWindowRegionRec        GetWindowRegionRec;
  348.  
  349. typedef GetWindowRegionRec *            GetWindowRegionPtr;
  350. typedef GetWindowRegionRec *            GetWindowRegionRecPtr;
  351. /*——————————————————————————————————————————————————————————————————————————————————————*/
  352. /* • New WDEF Message Types                                                                */
  353. /*——————————————————————————————————————————————————————————————————————————————————————*/
  354. /*
  355.    SetupWindowProxyDragImageRec - setup the proxy icon drag image
  356.    Both regions are allocated and disposed by the Window Manager.
  357.    The GWorld is disposed of by the Window Manager, but the WDEF must allocate
  358.    it.  See Technote on Drag Manager 1.1 additions for more information and sample code for
  359.    setting up drag images.
  360. */
  361.  
  362.  
  363. struct SetupWindowProxyDragImageRec {
  364.     GWorldPtr                         imageGWorld;                /* locked GWorld containing the drag image - output - can be NULL*/
  365.     RgnHandle                         imageRgn;                    /* image clip region, contains the portion of the image which gets blitted to screen - preallocated output - if imageGWorld is NULL, this is ignored*/
  366.     RgnHandle                         outlineRgn;                    /* the outline region used on shallow monitors - preallocated output - must always be non-empty*/
  367. };
  368. typedef struct SetupWindowProxyDragImageRec SetupWindowProxyDragImageRec;
  369. /* MeasureWindowTitleRec - a pointer to this is passed in WDEF param for kWindowMsgGetRegion*/
  370.  
  371. struct MeasureWindowTitleRec {
  372.                                                                 /* output parameters*/
  373.     SInt16                             fullTitleWidth;                /* text + proxy icon width*/
  374.     SInt16                             titleTextWidth;                /* text width*/
  375.  
  376.                                                                 /* input parameters*/
  377.     Boolean                         isUnicodeTitle;
  378.     Boolean                         unused;                        /* future use*/
  379. };
  380. typedef struct MeasureWindowTitleRec    MeasureWindowTitleRec;
  381. typedef MeasureWindowTitleRec *            MeasureWindowTitleRecPtr;
  382. /*——————————————————————————————————————————————————————————————————————————————————————*/
  383. /* • Standard Window Kinds                                                                */
  384. /*——————————————————————————————————————————————————————————————————————————————————————*/
  385.  
  386. enum {
  387.     dialogKind                    = 2,
  388.     userKind                    = 8,
  389.     kDialogWindowKind            = 2,
  390.     kApplicationWindowKind        = 8
  391. };
  392.  
  393.  
  394. /*——————————————————————————————————————————————————————————————————————————————————————*/
  395. /* • FindWindow Result Codes                                                            */
  396. /*——————————————————————————————————————————————————————————————————————————————————————*/
  397.  
  398. enum {
  399.     inDesk                        = 0,
  400.     inNoWindow                    = 0,
  401.     inMenuBar                    = 1,
  402.     inSysWindow                    = 2,
  403.     inContent                    = 3,
  404.     inDrag                        = 4,
  405.     inGrow                        = 5,
  406.     inGoAway                    = 6,
  407.     inZoomIn                    = 7,
  408.     inZoomOut                    = 8,
  409.     inCollapseBox                = 11
  410. };
  411.  
  412.  
  413. enum {
  414.     inProxyIcon                    = 12
  415. };
  416.  
  417. /*——————————————————————————————————————————————————————————————————————————————————————*/
  418. /* • Window Definition Hit Test Result Codes                                            */
  419. /*——————————————————————————————————————————————————————————————————————————————————————*/
  420.  
  421. enum {
  422.     wNoHit                        = 0,
  423.     wInContent                    = 1,
  424.     wInDrag                        = 2,
  425.     wInGrow                        = 3,
  426.     wInGoAway                    = 4,
  427.     wInZoomIn                    = 5,
  428.     wInZoomOut                    = 6,
  429.     wInCollapseBox                = 9
  430. };
  431.  
  432.  
  433. enum {
  434.     wInProxyIcon                = 10
  435. };
  436.  
  437. /*——————————————————————————————————————————————————————————————————————————————————————*/
  438. /* • Window Definition Messages                                                            */
  439. /*——————————————————————————————————————————————————————————————————————————————————————*/
  440.  
  441.  
  442. enum {
  443.     kWindowMsgDraw                = 0,
  444.     kWindowMsgHitTest            = 1,
  445.     kWindowMsgCalculateShape    = 2,
  446.     kWindowMsgInitialize        = 3,
  447.     kWindowMsgCleanUp            = 4,
  448.     kWindowMsgDrawGrowOutline    = 5,
  449.     kWindowMsgDrawGrowBox        = 6,
  450.     kWindowMsgGetFeatures        = 7,
  451.     kWindowMsgGetRegion            = 8
  452. };
  453.  
  454.  
  455. enum {
  456.     kWindowMsgDragHilite        = 9,                            /* parameter boolean indicating on or off*/
  457.     kWindowMsgModified            = 10,                            /* parameter boolean indicating saved (false) or modified (true)*/
  458.     kWindowMsgDrawInCurrentPort    = 11,                            /* same as kWindowMsgDraw, but must draw in current port*/
  459.     kWindowMsgSetupProxyDragImage = 12,                            /* parameter pointer to SetupWindowProxyDragImageRec*/
  460.     kWindowMsgStateChanged        = 13,                            /* something about the window's state has changed*/
  461.     kWindowMsgMeasureTitle        = 14                            /* measure and return the ideal title width*/
  462. };
  463.  
  464. /* old names*/
  465.  
  466. enum {
  467.     wDraw                        = 0,
  468.     wHit                        = 1,
  469.     wCalcRgns                    = 2,
  470.     wNew                        = 3,
  471.     wDispose                    = 4,
  472.     wGrow                        = 5,
  473.     wDrawGIcon                    = 6
  474. };
  475.  
  476. /*——————————————————————————————————————————————————————————————————————————————————————*/
  477. /* • State-changed Flags for kWindowMsgStateChanged                                        */
  478. /*——————————————————————————————————————————————————————————————————————————————————————*/
  479.  
  480. enum {
  481.     kWindowStateTitleChanged    = (1 << 0),
  482.     kWindowStateSizeChanged        = (1 << 1),
  483.     kWindowStatePositionChanged    = (1 << 2),
  484.     kWindowStateZOrderChanged    = (1 << 3),
  485.     kWindowStateVisibilityChanged = (1 << 4),
  486.     kWindowStateHiliteChanged    = (1 << 5),
  487.     kWindowStateCollapseChanged    = (1 << 6)
  488. };
  489.  
  490. /*——————————————————————————————————————————————————————————————————————————————————————*/
  491. /* • Window Feature Bits                                                                */
  492. /*——————————————————————————————————————————————————————————————————————————————————————*/
  493.  
  494. enum {
  495.     kWindowCanGrow                = (1 << 0),
  496.     kWindowCanZoom                = (1 << 1),
  497.     kWindowCanCollapse            = (1 << 2),
  498.     kWindowIsModal                = (1 << 3),
  499.     kWindowCanGetWindowRegion    = (1 << 4),
  500.     kWindowIsAlert                = (1 << 5),
  501.     kWindowHasTitleBar            = (1 << 6)
  502. };
  503.  
  504.  
  505. enum {
  506.     kWindowSupportsDragHilite    = (1 << 7),                        /* window definition supports kWindowMsgDragHilite*/
  507.     kWindowSupportsModifiedBit    = (1 << 8),                        /* window definition supports kWindowMsgModified*/
  508.     kWindowCanDrawInCurrentPort    = (1 << 9),                        /* window definition supports kWindowMsgDrawInCurrentPort*/
  509.     kWindowCanSetupProxyDragImage = (1 << 10),                    /* window definition supports kWindowMsgSetupProxyDragImage*/
  510.     kWindowCanMeasureTitle        = (1 << 11),                    /* window definition supports kWindowMsgMeasureTitle*/
  511.     kWindowWantsDisposeAtProcessDeath = (1 << 12)                /* window definition wants a Dispose message for windows still extant during ExitToShell*/
  512. };
  513.  
  514. /*——————————————————————————————————————————————————————————————————————————————————————*/
  515. /* • Desktop Pattern Resource ID                                                        */
  516. /*——————————————————————————————————————————————————————————————————————————————————————*/
  517.  
  518. enum {
  519.     deskPatID                    = 16
  520. };
  521.  
  522.  
  523.  
  524. /*——————————————————————————————————————————————————————————————————————————————————————*/
  525. /* • Window Color Part Codes                                                            */
  526. /*——————————————————————————————————————————————————————————————————————————————————————*/
  527.  
  528. enum {
  529.     wContentColor                = 0,
  530.     wFrameColor                    = 1,
  531.     wTextColor                    = 2,
  532.     wHiliteColor                = 3,
  533.     wTitleBarColor                = 4
  534. };
  535.  
  536.  
  537. /*——————————————————————————————————————————————————————————————————————————————————————*/
  538. /*    • Region Dragging Constants                                                            */
  539. /*——————————————————————————————————————————————————————————————————————————————————————*/
  540.  
  541.  
  542. enum {
  543.     kMouseUpOutOfSlop            = (long)0x80008000
  544. };
  545.  
  546.  
  547. /*——————————————————————————————————————————————————————————————————————————————————————*/
  548. /* • Window Color Table                                                                    */
  549. /*——————————————————————————————————————————————————————————————————————————————————————*/
  550.  
  551. struct WinCTab {
  552.     long                             wCSeed;                        /* reserved */
  553.     short                             wCReserved;                    /* reserved */
  554.     short                             ctSize;                        /* usually 4 for windows */
  555.     ColorSpec                         ctTable[5];
  556. };
  557. typedef struct WinCTab                    WinCTab;
  558.  
  559. typedef WinCTab *                        WCTabPtr;
  560. typedef WCTabPtr *                        WCTabHandle;
  561. /*——————————————————————————————————————————————————————————————————————————————————————*/
  562. /* • WindowRecord                                                                        */
  563. /*——————————————————————————————————————————————————————————————————————————————————————*/
  564. typedef struct WindowRecord             WindowRecord;
  565. typedef WindowRecord *                    WindowPeek;
  566.  
  567. struct WindowRecord {
  568.     GrafPort                         port;
  569.     short                             windowKind;
  570.     Boolean                         visible;
  571.     Boolean                         hilited;
  572.     Boolean                         goAwayFlag;
  573.     Boolean                         spareFlag;
  574.     RgnHandle                         strucRgn;
  575.     RgnHandle                         contRgn;
  576.     RgnHandle                         updateRgn;
  577.     Handle                             windowDefProc;
  578.     Handle                             dataHandle;
  579.     StringHandle                     titleHandle;
  580.     short                             titleWidth;
  581.     Handle                             controlList;
  582.     WindowPeek                         nextWindow;
  583.     PicHandle                         windowPic;
  584.     long                             refCon;
  585. };
  586.  
  587. /*——————————————————————————————————————————————————————————————————————————————————————*/
  588. /* • Color WindowRecord                                                                    */
  589. /*——————————————————————————————————————————————————————————————————————————————————————*/
  590. typedef struct CWindowRecord             CWindowRecord;
  591. typedef CWindowRecord *                    CWindowPeek;
  592.  
  593. struct CWindowRecord {
  594.     CGrafPort                         port;
  595.     short                             windowKind;
  596.     Boolean                         visible;
  597.     Boolean                         hilited;
  598.     Boolean                         goAwayFlag;
  599.     Boolean                         spareFlag;
  600.     RgnHandle                         strucRgn;
  601.     RgnHandle                         contRgn;
  602.     RgnHandle                         updateRgn;
  603.     Handle                             windowDefProc;
  604.     Handle                             dataHandle;
  605.     StringHandle                     titleHandle;
  606.     short                             titleWidth;
  607.     Handle                             controlList;
  608.     CWindowPeek                     nextWindow;
  609.     PicHandle                         windowPic;
  610.     long                             refCon;
  611. };
  612.  
  613. /*——————————————————————————————————————————————————————————————————————————————————————*/
  614. /* • AuxWinHandle                                                                        */
  615. /*——————————————————————————————————————————————————————————————————————————————————————*/
  616. typedef struct AuxWinRec                 AuxWinRec;
  617. typedef AuxWinRec *                        AuxWinPtr;
  618. typedef AuxWinPtr *                        AuxWinHandle;
  619.  
  620. struct AuxWinRec {
  621.     AuxWinHandle                     awNext;                        /*handle to next AuxWinRec*/
  622.     WindowPtr                         awOwner;                    /*ptr to window */
  623.     CTabHandle                         awCTable;                    /*color table for this window*/
  624.     Handle                             reserved;
  625.     long                             awFlags;                    /*reserved for expansion*/
  626.     CTabHandle                         awReserved;                    /*reserved for expansion*/
  627.     long                             awRefCon;                    /*user Constant*/
  628. };
  629.  
  630. /*——————————————————————————————————————————————————————————————————————————————————————*/
  631. /*    • BasicWindowDescription                                                            */
  632. /*                                                                                        */
  633. /*    Contains statically-sized basic attributes of the window, for storage in a            */
  634. /*    collection item.                                                                    */
  635. /*——————————————————————————————————————————————————————————————————————————————————————*/
  636. /* constants for the version field*/
  637.  
  638. enum {
  639.     kWindowDefinitionVersionOne    = 1,
  640.     kWindowDefinitionVersionTwo    = 2
  641. };
  642.  
  643. /* constants for the stateflags bit field */
  644.  
  645. enum {
  646.     kWindowIsCollapsedState        = (1 << 0L)
  647. };
  648.  
  649.  
  650. struct BasicWindowDescription {
  651.     UInt32                             descriptionSize;            /* sizeof(BasicWindowDescription)*/
  652.  
  653.     Rect                             windowContentRect;            /* location on screen*/
  654.     Rect                             windowZoomRect;                /* location on screen when zoomed out*/
  655.     UInt32                             windowRefCon;                /* the refcon - __avoid saving stale pointers here__    */
  656.     UInt32                             windowStateFlags;            /* flags indicating status of transient window state*/
  657.     WindowPositionMethod             windowPositionMethod;        /* method last used by RepositionWindow to position the window (if any)*/
  658.  
  659.     UInt32                             windowDefinitionVersion;
  660.     union {
  661.         struct {
  662.             SInt16                             windowDefProc;        /* defProc and variant*/
  663.             Boolean                         windowHasCloseBox;
  664.         }                                 versionOne;
  665.  
  666.         struct {
  667.             WindowClass                     windowClass;        /* the class*/
  668.             WindowAttributes                 windowAttributes;    /* the attributes*/
  669.         }                                 versionTwo;
  670.  
  671.     }                                 windowDefinition;
  672. };
  673. typedef struct BasicWindowDescription    BasicWindowDescription;
  674. /*  the window manager stores the default collection items using these IDs*/
  675.  
  676. enum {
  677.     kStoredWindowSystemTag        = FOUR_CHAR_CODE('appl'),        /* Only Apple collection items will be of this tag*/
  678.     kStoredBasicWindowDescriptionID = FOUR_CHAR_CODE('sbas'),    /* BasicWindowDescription*/
  679.     kStoredWindowPascalTitleID    = FOUR_CHAR_CODE('s255'),        /* pascal title string*/
  680.     kStoredWindowUnicodeTitleID    = FOUR_CHAR_CODE('ustr')        /* Unicode title string*/
  681. };
  682.  
  683. /*——————————————————————————————————————————————————————————————————————————————————————*/
  684. /* • Window Class Ordering                                                                */
  685. /*                                                                                        */
  686. /*    Special cases for the “behind” parameter in window creation calls.                    */
  687. /*——————————————————————————————————————————————————————————————————————————————————————*/
  688. #define kFirstWindowOfClass ((WindowPtr)-1L)
  689. #define kLastWindowOfClass ((WindowPtr)0L)
  690. /*——————————————————————————————————————————————————————————————————————————————————————*/
  691. /* • Zoom Information Handle                                                             */
  692. /*——————————————————————————————————————————————————————————————————————————————————————*/
  693.  
  694. struct WStateData {
  695.     Rect                             userState;                    /*user zoom state*/
  696.     Rect                             stdState;                    /*standard zoom state*/
  697. };
  698. typedef struct WStateData                WStateData;
  699. typedef WStateData *                    WStateDataPtr;
  700. typedef WStateDataPtr *                    WStateDataHandle;
  701. /*——————————————————————————————————————————————————————————————————————————————————————*/
  702. /* • Window Creation & Persistence                                                        */
  703. /*——————————————————————————————————————————————————————————————————————————————————————*/
  704.  
  705. EXTERN_API( OSStatus )
  706. CreateNewWindow                    (WindowClass             windowClass,
  707.                                  WindowAttributes         attributes,
  708.                                  const Rect *            bounds,
  709.                                  WindowPtr *            outWindow);
  710.  
  711. /* Create a window from a ‘wind’ resource*/
  712. EXTERN_API( OSStatus )
  713. CreateWindowFromResource        (SInt16                 resID,
  714.                                  WindowPtr *            outWindow);
  715.  
  716. /* window persistence*/
  717. EXTERN_API( OSStatus )
  718. StoreWindowIntoCollection        (WindowPtr                 window,
  719.                                  Collection             collection);
  720.  
  721. EXTERN_API( OSStatus )
  722. CreateWindowFromCollection        (Collection             collection,
  723.                                  WindowPtr *            outWindow);
  724.  
  725. /* window refcounting*/
  726. EXTERN_API( OSStatus )
  727. GetWindowOwnerCount                (WindowPtr                 window,
  728.                                  UInt32 *                outCount);
  729.  
  730. /*
  731.    CloneWindow increments the window’s refcount.  DisposeWindow decrements the refcount, and
  732.    disposes only when the refcount reaches zero.  All windows begin life with a refcount of one.
  733.    CloseWindow _does not_ pay attention to the refcount, and should therefore be considered
  734.    deprecated.
  735. */
  736. EXTERN_API( OSStatus )
  737. CloneWindow                        (WindowPtr                 window);
  738.  
  739. EXTERN_API( WindowPtr )
  740. GetNewCWindow                    (short                     windowID,
  741.                                  void *                    wStorage,
  742.                                  WindowPtr                 behind)                                ONEWORDINLINE(0xAA46);
  743.  
  744. EXTERN_API( WindowPtr )
  745. NewWindow                        (void *                    wStorage,
  746.                                  const Rect *            boundsRect,
  747.                                  ConstStr255Param         title,
  748.                                  Boolean                 visible,
  749.                                  short                     theProc,
  750.                                  WindowPtr                 behind,
  751.                                  Boolean                 goAwayFlag,
  752.                                  long                     refCon)                                ONEWORDINLINE(0xA913);
  753.  
  754. EXTERN_API( WindowPtr )
  755. GetNewWindow                    (short                     windowID,
  756.                                  void *                    wStorage,
  757.                                  WindowPtr                 behind)                                ONEWORDINLINE(0xA9BD);
  758.  
  759. EXTERN_API( WindowPtr )
  760. NewCWindow                        (void *                    wStorage,
  761.                                  const Rect *            boundsRect,
  762.                                  ConstStr255Param         title,
  763.                                  Boolean                 visible,
  764.                                  short                     procID,
  765.                                  WindowPtr                 behind,
  766.                                  Boolean                 goAwayFlag,
  767.                                  long                     refCon)                                ONEWORDINLINE(0xAA45);
  768.  
  769. EXTERN_API( void )
  770. DisposeWindow                    (WindowPtr                 window)                                ONEWORDINLINE(0xA914);
  771.  
  772. #if TARGET_OS_MAC
  773.     #define MacCloseWindow CloseWindow
  774. #endif
  775. EXTERN_API( void )
  776. MacCloseWindow                    (WindowPtr                 window)                                ONEWORDINLINE(0xA92D);
  777.  
  778.  
  779.  
  780. /*——————————————————————————————————————————————————————————————————————————————————————*/
  781. /* • Window Class Accessors                                                                */
  782. /*——————————————————————————————————————————————————————————————————————————————————————*/
  783. EXTERN_API( OSStatus )
  784. GetWindowClass                    (WindowPtr                 window,
  785.                                  WindowClass *            outClass);
  786.  
  787. EXTERN_API( OSStatus )
  788. GetWindowAttributes                (WindowPtr                 window,
  789.                                  WindowAttributes *        outAttributes);
  790.  
  791.  
  792. /*——————————————————————————————————————————————————————————————————————————————————————*/
  793. /* • Floating Windows                                                                    */
  794. /*——————————————————————————————————————————————————————————————————————————————————————*/
  795. EXTERN_API( OSStatus )
  796. ShowFloatingWindows                (void);
  797.  
  798. EXTERN_API( OSStatus )
  799. HideFloatingWindows                (void);
  800.  
  801. EXTERN_API( Boolean )
  802. AreFloatingWindowsVisible        (void);
  803.  
  804. EXTERN_API( WindowPtr )
  805. FrontNonFloatingWindow            (void);
  806.  
  807.  
  808. /*——————————————————————————————————————————————————————————————————————————————————————*/
  809. /* • Background Imaging                                                                    */
  810. /*——————————————————————————————————————————————————————————————————————————————————————*/
  811. EXTERN_API( OSStatus )
  812. SetWindowContentColor            (WindowPtr                 window,
  813.                                  RGBColor *                color);
  814.  
  815. EXTERN_API( OSStatus )
  816. GetWindowContentColor            (WindowPtr                 window,
  817.                                  RGBColor *                color);
  818.  
  819. EXTERN_API( OSStatus )
  820. GetWindowContentPattern            (WindowPtr                 window,
  821.                                  PixPatHandle             outPixPat);
  822.  
  823. EXTERN_API( OSStatus )
  824. SetWindowContentPattern            (WindowPtr                 window,
  825.                                  PixPatHandle             pixPat);
  826.  
  827. EXTERN_API( void )
  828. SetWinColor                        (WindowPtr                 window,
  829.                                  WCTabHandle             newColorTable)                        ONEWORDINLINE(0xAA41);
  830.  
  831. EXTERN_API( void )
  832. SetDeskCPat                        (PixPatHandle             deskPixPat)                            ONEWORDINLINE(0xAA47);
  833.  
  834.  
  835.  
  836. /*——————————————————————————————————————————————————————————————————————————————————————*/
  837. /* • Low-Level Region & Painting Routines                                                */
  838. /*——————————————————————————————————————————————————————————————————————————————————————*/
  839. EXTERN_API( void )
  840. ClipAbove                        (WindowPtr                 window)                                ONEWORDINLINE(0xA90B);
  841.  
  842. EXTERN_API( void )
  843. SaveOld                            (WindowPtr                 window)                                ONEWORDINLINE(0xA90E);
  844.  
  845. EXTERN_API( void )
  846. DrawNew                            (WindowPtr                 window,
  847.                                  Boolean                 update)                                ONEWORDINLINE(0xA90F);
  848.  
  849. EXTERN_API( void )
  850. PaintOne                        (WindowPtr                 window,
  851.                                  RgnHandle                 clobberedRgn)                        ONEWORDINLINE(0xA90C);
  852.  
  853. EXTERN_API( void )
  854. PaintBehind                        (WindowPtr                 startWindow,
  855.                                  RgnHandle                 clobberedRgn)                        ONEWORDINLINE(0xA90D);
  856.  
  857. EXTERN_API( void )
  858. CalcVis                            (WindowPtr                 window)                                ONEWORDINLINE(0xA909);
  859.  
  860. EXTERN_API( void )
  861. CalcVisBehind                    (WindowPtr                 startWindow,
  862.                                  RgnHandle                 clobberedRgn)                        ONEWORDINLINE(0xA90A);
  863.  
  864. EXTERN_API( Boolean )
  865. CheckUpdate                        (EventRecord *            theEvent)                            ONEWORDINLINE(0xA911);
  866.  
  867. /*——————————————————————————————————————————————————————————————————————————————————————*/
  868. /* • Window List                                                                        */
  869. /*——————————————————————————————————————————————————————————————————————————————————————*/
  870. #if TARGET_OS_MAC
  871.     #define MacFindWindow FindWindow
  872. #endif
  873. EXTERN_API( short )
  874. MacFindWindow                    (Point                     thePoint,
  875.                                  WindowPtr *            window)                                ONEWORDINLINE(0xA92C);
  876.  
  877. EXTERN_API( WindowPtr )
  878. FrontWindow                        (void)                                                        ONEWORDINLINE(0xA924);
  879.  
  880. EXTERN_API( void )
  881. BringToFront                    (WindowPtr                 window)                                ONEWORDINLINE(0xA920);
  882.  
  883. EXTERN_API( void )
  884. SendBehind                        (WindowPtr                 window,
  885.                                  WindowPtr                 behindWindow)                        ONEWORDINLINE(0xA921);
  886.  
  887. EXTERN_API( void )
  888. SelectWindow                    (WindowPtr                 window)                                ONEWORDINLINE(0xA91F);
  889.  
  890.  
  891. /*——————————————————————————————————————————————————————————————————————————————————————*/
  892. /* • Misc Low-Level stuff                                                                            */
  893. /*——————————————————————————————————————————————————————————————————————————————————————*/
  894. EXTERN_API( Boolean )
  895. IsValidWindowPtr                (GrafPtr                 grafPort);
  896.  
  897. /* call either InitFloatingWindows or InitWindows, not both*/
  898. EXTERN_API( OSStatus )
  899. InitFloatingWindows                (void);
  900.  
  901. EXTERN_API( void )
  902. InitWindows                        (void)                                                        ONEWORDINLINE(0xA912);
  903.  
  904. EXTERN_API( void )
  905. GetWMgrPort                        (GrafPtr *                wPort)                                ONEWORDINLINE(0xA910);
  906.  
  907. EXTERN_API( void )
  908. GetCWMgrPort                    (CGrafPtr *                wMgrCPort)                            ONEWORDINLINE(0xAA48);
  909.  
  910.  
  911.  
  912. /*——————————————————————————————————————————————————————————————————————————————————————*/
  913. /* • Various & Sundry Window Accessors                                                            */
  914. /*——————————————————————————————————————————————————————————————————————————————————————*/
  915. EXTERN_API( void )
  916. HiliteWindow                    (WindowPtr                 window,
  917.                                  Boolean                 fHilite)                            ONEWORDINLINE(0xA91C);
  918.  
  919. /* GetWindowFeatures & GetWindowRegion are available with Appearance 1.0 and later*/
  920. EXTERN_API( OSStatus )
  921. GetWindowFeatures                (WindowPtr                 window,
  922.                                  UInt32 *                outFeatures)                        THREEWORDINLINE(0x303C, 0x0013, 0xAA74);
  923.  
  924. EXTERN_API( OSStatus )
  925. GetWindowRegion                    (WindowPtr                 window,
  926.                                  WindowRegionCode         inRegionCode,
  927.                                  RgnHandle                 ioWinRgn)                            THREEWORDINLINE(0x303C, 0x0014, 0xAA74);
  928.  
  929. EXTERN_API( void )
  930. SetWRefCon                        (WindowPtr                 window,
  931.                                  long                     data)                                ONEWORDINLINE(0xA918);
  932.  
  933. EXTERN_API( long )
  934. GetWRefCon                        (WindowPtr                 window)                                ONEWORDINLINE(0xA917);
  935.  
  936. EXTERN_API( void )
  937. SetWindowPic                    (WindowPtr                 window,
  938.                                  PicHandle                 pic)                                ONEWORDINLINE(0xA92E);
  939.  
  940. EXTERN_API( PicHandle )
  941. GetWindowPic                    (WindowPtr                 window)                                ONEWORDINLINE(0xA92F);
  942.  
  943. EXTERN_API( short )
  944. GetWVariant                        (WindowPtr                 window)                                ONEWORDINLINE(0xA80A);
  945.  
  946. /*——————————————————————————————————————————————————————————————————————————————————————*/
  947. /* • Update Events                                                                        */
  948. /*——————————————————————————————————————————————————————————————————————————————————————*/
  949. EXTERN_API( OSStatus )
  950. InvalWindowRgn                    (WindowPtr                 window,
  951.                                  RgnHandle                 region);
  952.  
  953. EXTERN_API( OSStatus )
  954. InvalWindowRect                    (WindowPtr                 window,
  955.                                  const Rect *            bounds);
  956.  
  957. EXTERN_API( OSStatus )
  958. ValidWindowRgn                    (WindowPtr                 window,
  959.                                  RgnHandle                 region);
  960.  
  961. EXTERN_API( OSStatus )
  962. ValidWindowRect                    (WindowPtr                 window,
  963.                                  const Rect *            bounds);
  964.  
  965. EXTERN_API( void )
  966. InvalRect                        (const Rect *            badRect)                            ONEWORDINLINE(0xA928);
  967.  
  968. EXTERN_API( void )
  969. InvalRgn                        (RgnHandle                 badRgn)                                ONEWORDINLINE(0xA927);
  970.  
  971. EXTERN_API( void )
  972. ValidRect                        (const Rect *            goodRect)                            ONEWORDINLINE(0xA92A);
  973.  
  974. EXTERN_API( void )
  975. ValidRgn                        (RgnHandle                 goodRgn)                            ONEWORDINLINE(0xA929);
  976.  
  977. EXTERN_API( void )
  978. BeginUpdate                        (WindowPtr                 window)                                ONEWORDINLINE(0xA922);
  979.  
  980. EXTERN_API( void )
  981. EndUpdate                        (WindowPtr                 window)                                ONEWORDINLINE(0xA923);
  982.  
  983.  
  984. /*——————————————————————————————————————————————————————————————————————————————————————*/
  985. /* • DrawGrowIcon                                                                        */
  986. /*                                                                                        */
  987. /*    With the advent of Appearance, DrawGrowIcon is obsolete.  Beginning with Appearance    */
  988. /*    1.0    the system WDEF automagically draws the grow icon for growable window            */
  989. /*    procIDs.                                                                            */
  990. /*——————————————————————————————————————————————————————————————————————————————————————*/
  991. EXTERN_API( void )
  992. DrawGrowIcon                    (WindowPtr                 window)                                ONEWORDINLINE(0xA904);
  993.  
  994.  
  995. /*——————————————————————————————————————————————————————————————————————————————————————*/
  996. /* • Window Titles & Document Support                                                    */
  997. /*——————————————————————————————————————————————————————————————————————————————————————*/
  998. EXTERN_API( void )
  999. SetWTitle                        (WindowPtr                 window,
  1000.                                  ConstStr255Param         title)                                ONEWORDINLINE(0xA91A);
  1001.  
  1002. EXTERN_API( void )
  1003. GetWTitle                        (WindowPtr                 window,
  1004.                                  Str255                 title)                                ONEWORDINLINE(0xA919);
  1005.  
  1006.  
  1007. EXTERN_API( OSStatus )
  1008. SetWindowProxyFSSpec            (WindowPtr                 window,
  1009.                                  const FSSpec *            inFile);
  1010.  
  1011. EXTERN_API( OSStatus )
  1012. GetWindowProxyFSSpec            (WindowPtr                 window,
  1013.                                  FSSpec *                outFile);
  1014.  
  1015. EXTERN_API( OSStatus )
  1016. SetWindowProxyAlias                (WindowPtr                 window,
  1017.                                  AliasHandle             alias);
  1018.  
  1019. EXTERN_API( OSStatus )
  1020. GetWindowProxyAlias                (WindowPtr                 window,
  1021.                                  AliasHandle *            alias);
  1022.  
  1023. EXTERN_API( OSStatus )
  1024. SetWindowProxyCreatorAndType    (WindowPtr                 window,
  1025.                                  OSType                 fileCreator,
  1026.                                  OSType                 fileType,
  1027.                                  SInt16                 vRefNum);
  1028.  
  1029. EXTERN_API( OSStatus )
  1030. GetWindowProxyIcon                (WindowPtr                 window,
  1031.                                  IconRef *                outIcon);
  1032.  
  1033. EXTERN_API( OSStatus )
  1034. SetWindowProxyIcon                (WindowPtr                 window,
  1035.                                  IconRef                 icon);
  1036.  
  1037. EXTERN_API( OSStatus )
  1038. RemoveWindowProxy                (WindowPtr                 window);
  1039.  
  1040. EXTERN_API( OSStatus )
  1041. BeginWindowProxyDrag            (WindowPtr                 window,
  1042.                                  DragReference *        outNewDrag,
  1043.                                  RgnHandle                 outDragOutlineRgn);
  1044.  
  1045. EXTERN_API( OSStatus )
  1046. EndWindowProxyDrag                (WindowPtr                 window,
  1047.                                  DragReference             theDrag);
  1048.  
  1049. EXTERN_API( OSStatus )
  1050. TrackWindowProxyFromExistingDrag (WindowPtr             window,
  1051.                                  Point                     startPt,
  1052.                                  DragReference             drag,
  1053.                                  RgnHandle                 inDragOutlineRgn);
  1054.  
  1055. EXTERN_API( OSStatus )
  1056. TrackWindowProxyDrag            (WindowPtr                 window,
  1057.                                  Point                     startPt);
  1058.  
  1059.  
  1060. /* window document dirty bit*/
  1061.  
  1062. EXTERN_API( Boolean )
  1063. IsWindowModified                (WindowPtr                 window);
  1064.  
  1065. EXTERN_API( OSStatus )
  1066. SetWindowModified                (WindowPtr                 window,
  1067.                                  Boolean                 modified);
  1068.  
  1069. /* file path stuff*/
  1070.  
  1071. EXTERN_API( Boolean )
  1072. IsWindowPathSelectClick            (WindowPtr                 window,
  1073.                                  EventRecord *            event);
  1074.  
  1075. /*
  1076.    The Window Manager will provide default menus and AppleEvent-posting behavior for file
  1077.    proxies if you pass NULL for menu.  On output, outMenuItem contains a MenuSelect-style
  1078.    return value, id and item in a single 32-bit word.  WindowPathSelect will temporarily
  1079.    insert the menu into the menu list.
  1080. */
  1081. EXTERN_API( OSStatus )
  1082. WindowPathSelect                (WindowPtr                 window,
  1083.                                  MenuHandle             menu, /* can be NULL */
  1084.                                  SInt32 *                outMenuResult);
  1085.  
  1086.  
  1087. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1088. /*    • HiliteWindowFrameForDrag                                                            */
  1089. /*                                                                                        */
  1090. /*    If you call ShowDragHilite and HideDragHilite, you don’t need to use this procedure.*/
  1091. /*    If you implement custom drag hiliting, you must call HiliteWindowFrameForDrag when    */
  1092. /*    the drag is tracking inside    a window with drag-hilited content.                        */
  1093. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1094. EXTERN_API( OSStatus )
  1095. HiliteWindowFrameForDrag        (WindowPtr                 window,
  1096.                                  Boolean                 hilited)                            TWOWORDINLINE(0x7019, 0xA829);
  1097.  
  1098.  
  1099. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1100. /* • Window Transitions                                                                    */
  1101. /*                                                                                         */
  1102. /*     TransitionWindow allows you to display a window using animation and sound.            */
  1103. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1104.  
  1105. typedef UInt32                             WindowTransitionEffect;
  1106.  
  1107. enum {
  1108.     kWindowZoomTransitionEffect    = 1                                /* Finder-like zoom rectangles, use with Show or Open transition actions*/
  1109. };
  1110.  
  1111. typedef UInt32                             WindowTransitionAction;
  1112.  
  1113. enum {
  1114.     kWindowShowTransitionAction    = 1,                            /* param is rect in global coordinates from which to start the animation*/
  1115.     kWindowHideTransitionAction    = 2                                /* param is rect in global coordinates at which to end the animation*/
  1116. };
  1117.  
  1118. EXTERN_API( OSStatus )
  1119. TransitionWindow                (WindowPtr                 window,
  1120.                                  WindowTransitionEffect  effect,
  1121.                                  WindowTransitionAction  action,
  1122.                                  const Rect *            rect) /* can be NULL */;
  1123.  
  1124. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1125. /* • Window Positioning                                                                    */
  1126. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1127. EXTERN_API( OSStatus )
  1128. RepositionWindow                (WindowPtr                 window,
  1129.                                  WindowPtr                 parentWindow,
  1130.                                  WindowPositionMethod     method);
  1131.  
  1132. /* manipulate the size of the window, using coordiantes pinned to the specified region (content or structure)*/
  1133. EXTERN_API( OSStatus )
  1134. SetWindowBounds                    (WindowPtr                 window,
  1135.                                  WindowRegionCode         regionCode,
  1136.                                  const Rect *            globalBounds);
  1137.  
  1138. EXTERN_API( OSStatus )
  1139. GetWindowBounds                    (WindowPtr                 window,
  1140.                                  WindowRegionCode         regionCode,
  1141.                                  Rect *                    globalBounds);
  1142.  
  1143. /* move the window, pinned to the structure region rather than, as in MoveWindow, the content region*/
  1144. EXTERN_API( OSStatus )
  1145. MoveWindowStructure                (WindowPtr                 window,
  1146.                                  short                     hGlobal,
  1147.                                  short                     vGlobal);
  1148.  
  1149. /* GrowWindow and SizeWindow in one groovy call*/
  1150. EXTERN_API( Boolean )
  1151. ResizeWindow                    (WindowPtr                 window,
  1152.                                  Point                     startPoint,
  1153.                                  const Rect *            sizeConstraints, /* can be NULL */
  1154.                                  Rect *                    newContentRect);
  1155.  
  1156. EXTERN_API( Boolean )
  1157. IsWindowCollapsable                (WindowPtr                 window)                                THREEWORDINLINE(0x303C, 0x000F, 0xAA74);
  1158.  
  1159. EXTERN_API( Boolean )
  1160. IsWindowCollapsed                (WindowPtr                 window)                                THREEWORDINLINE(0x303C, 0x0010, 0xAA74);
  1161.  
  1162. EXTERN_API( OSStatus )
  1163. CollapseWindow                    (WindowPtr                 window,
  1164.                                  Boolean                 collapse)                            THREEWORDINLINE(0x303C, 0x0011, 0xAA74);
  1165.  
  1166. EXTERN_API( OSStatus )
  1167. CollapseAllWindows                (Boolean                 collapse)                            THREEWORDINLINE(0x303C, 0x0012, 0xAA74);
  1168.  
  1169. #if TARGET_OS_MAC
  1170.     #define MacMoveWindow MoveWindow
  1171. #endif
  1172. EXTERN_API( void )
  1173. MacMoveWindow                    (WindowPtr                 window,
  1174.                                  short                     hGlobal,
  1175.                                  short                     vGlobal,
  1176.                                  Boolean                 front)                                ONEWORDINLINE(0xA91B);
  1177.  
  1178. EXTERN_API( void )
  1179. SizeWindow                        (WindowPtr                 window,
  1180.                                  short                     w,
  1181.                                  short                     h,
  1182.                                  Boolean                 fUpdate)                            ONEWORDINLINE(0xA91D);
  1183.  
  1184.  
  1185. EXTERN_API( void )
  1186. ZoomWindow                        (WindowPtr                 window,
  1187.                                  short                     partCode,
  1188.                                  Boolean                 front)                                ONEWORDINLINE(0xA83A);
  1189.  
  1190. EXTERN_API( Boolean )
  1191. IsWindowInStandardState            (WindowPtr                 window,
  1192.                                  Point *                idealSize,
  1193.                                  Rect *                    idealStandardState);
  1194.  
  1195. /* Zoomin’!  All apps should use ZoomWindowIdeal in place of ZoomWindow.*/
  1196. EXTERN_API( OSStatus )
  1197. ZoomWindowIdeal                    (WindowPtr                 window,
  1198.                                  SInt16                 partCode,
  1199.                                  Point *                ioIdealSize);
  1200.  
  1201. EXTERN_API( OSStatus )
  1202. GetWindowIdealUserState            (WindowPtr                 window,
  1203.                                  Rect *                    userState);
  1204.  
  1205. EXTERN_API( OSStatus )
  1206. SetWindowIdealUserState            (WindowPtr                 window,
  1207.                                  Rect *                    userState);
  1208.  
  1209. EXTERN_API( long )
  1210. GrowWindow                        (WindowPtr                 window,
  1211.                                  Point                     startPt,
  1212.                                  const Rect *            bBox)                                ONEWORDINLINE(0xA92B);
  1213.  
  1214. EXTERN_API( void )
  1215. DragWindow                        (WindowPtr                 window,
  1216.                                  Point                     startPt,
  1217.                                  const Rect *            boundsRect)                            ONEWORDINLINE(0xA925);
  1218.  
  1219.  
  1220. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1221. /* • Window Visibility                                                                    */
  1222. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1223.  
  1224. EXTERN_API( void )
  1225. HideWindow                        (WindowPtr                 window)                                ONEWORDINLINE(0xA916);
  1226.  
  1227. #if TARGET_OS_MAC
  1228.     #define MacShowWindow ShowWindow
  1229. #endif
  1230. EXTERN_API( void )
  1231. MacShowWindow                    (WindowPtr                 window)                                ONEWORDINLINE(0xA915);
  1232.  
  1233. EXTERN_API( void )
  1234. ShowHide                        (WindowPtr                 window,
  1235.                                  Boolean                 showFlag)                            ONEWORDINLINE(0xA908);
  1236.  
  1237.  
  1238. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1239. /* • Window Properties                                                                            */
  1240. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1241.  
  1242. EXTERN_API( OSStatus )
  1243. GetWindowProperty                (WindowPtr                 window,
  1244.                                  PropertyCreator         propertyCreator,
  1245.                                  PropertyTag             propertyTag,
  1246.                                  UInt32                 bufferSize,
  1247.                                  UInt32 *                actualSize, /* can be NULL */
  1248.                                  void *                    propertyBuffer);
  1249.  
  1250. EXTERN_API( OSStatus )
  1251. GetWindowPropertySize            (WindowPtr                 window,
  1252.                                  PropertyCreator         creator,
  1253.                                  PropertyTag             tag,
  1254.                                  UInt32 *                size);
  1255.  
  1256. EXTERN_API( OSStatus )
  1257. SetWindowProperty                (WindowPtr                 window,
  1258.                                  PropertyCreator         propertyCreator,
  1259.                                  PropertyTag             propertyTag,
  1260.                                  UInt32                 propertySize,
  1261.                                  void *                    propertyBuffer);
  1262.  
  1263. EXTERN_API( OSStatus )
  1264. RemoveWindowProperty            (WindowPtr                 window,
  1265.                                  PropertyCreator         propertyCreator,
  1266.                                  PropertyTag             propertyTag);
  1267.  
  1268. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1269. /* • Utilities                                                                            */
  1270. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1271. EXTERN_API( long )
  1272. PinRect                            (const Rect *            theRect,
  1273.                                  Point                     thePt)                                ONEWORDINLINE(0xA94E);
  1274.  
  1275.  
  1276. EXTERN_API( RgnHandle )
  1277. GetGrayRgn                        (void)                                                        TWOWORDINLINE(0x2EB8, 0x09EE);
  1278.  
  1279.  
  1280. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1281. /* • Window Part Tracking                                                                */
  1282. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1283. EXTERN_API( Boolean )
  1284. TrackBox                        (WindowPtr                 window,
  1285.                                  Point                     thePt,
  1286.                                  short                     partCode)                            ONEWORDINLINE(0xA83B);
  1287.  
  1288. EXTERN_API( Boolean )
  1289. TrackGoAway                        (WindowPtr                 window,
  1290.                                  Point                     thePt)                                ONEWORDINLINE(0xA91E);
  1291.  
  1292.  
  1293. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1294. /* • Region Dragging                                                                    */
  1295. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1296. EXTERN_API( long )
  1297. DragGrayRgn                        (RgnHandle                 theRgn,
  1298.                                  Point                     startPt,
  1299.                                  const Rect *            limitRect,
  1300.                                  const Rect *            slopRect,
  1301.                                  short                     axis,
  1302.                                  DragGrayRgnUPP         actionProc)                            ONEWORDINLINE(0xA905);
  1303.  
  1304. EXTERN_API( long )
  1305. DragTheRgn                        (RgnHandle                 theRgn,
  1306.                                  Point                     startPt,
  1307.                                  const Rect *            limitRect,
  1308.                                  const Rect *            slopRect,
  1309.                                  short                     axis,
  1310.                                  DragGrayRgnUPP         actionProc)                            ONEWORDINLINE(0xA926);
  1311.  
  1312.  
  1313. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1314. /*    • GetAuxWin                                                                            */
  1315. /*                                                                                        */
  1316. /*    Avoid using GetAuxWin if at all possible                                            */
  1317. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1318. EXTERN_API( Boolean )
  1319. GetAuxWin                        (WindowPtr                 window,
  1320.                                  AuxWinHandle *            awHndl)                                ONEWORDINLINE(0xAA42);
  1321.  
  1322.  
  1323. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1324. /* • MixedMode & ProcPtrs                                                                */
  1325. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1326. typedef CALLBACK_API( long , WindowDefProcPtr )(short varCode, WindowPtr window, short message, long param);
  1327. typedef CALLBACK_API( void , DeskHookProcPtr )(Boolean mouseClick, EventRecord *theEvent);
  1328. /*
  1329.     WARNING: DeskHookProcPtr uses register based parameters under classic 68k
  1330.              and cannot be written in a high-level language without 
  1331.              the help of mixed mode or assembly glue.
  1332. */
  1333. typedef STACK_UPP_TYPE(WindowDefProcPtr)                         WindowDefUPP;
  1334. typedef REGISTER_UPP_TYPE(DeskHookProcPtr)                         DeskHookUPP;
  1335. enum { uppWindowDefProcInfo = 0x00003BB0 };                     /* pascal 4_bytes Func(2_bytes, 4_bytes, 2_bytes, 4_bytes) */
  1336. enum { uppDeskHookProcInfo = 0x00130802 };                         /* register no_return_value Func(1_byte:D0, 4_bytes:A0) */
  1337. #define NewWindowDefProc(userRoutine)                             (WindowDefUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppWindowDefProcInfo, GetCurrentArchitecture())
  1338. #define NewDeskHookProc(userRoutine)                             (DeskHookUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppDeskHookProcInfo, GetCurrentArchitecture())
  1339. #define CallWindowDefProc(userRoutine, varCode, window, message, param)  CALL_FOUR_PARAMETER_UPP((userRoutine), uppWindowDefProcInfo, (varCode), (window), (message), (param))
  1340. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1341.     #pragma parameter CallDeskHookProc(__A1, __D0, __A0)
  1342.     void CallDeskHookProc(DeskHookUPP routine, Boolean mouseClick, EventRecord * theEvent) = 0x4E91;
  1343. #else
  1344.     #define CallDeskHookProc(userRoutine, mouseClick, theEvent)  CALL_TWO_PARAMETER_UPP((userRoutine), uppDeskHookProcInfo, (mouseClick), (theEvent))
  1345. #endif
  1346. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1347. /* • C Glue                                                                                */
  1348. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1349. #if CGLUESUPPORTED
  1350. EXTERN_API_C( void )
  1351. setwtitle                        (WindowPtr                 window,
  1352.                                  const char *            title);
  1353.  
  1354. EXTERN_API_C( Boolean )
  1355. trackgoaway                        (WindowPtr                 window,
  1356.                                  Point *                thePt);
  1357.  
  1358. EXTERN_API_C( short )
  1359. findwindow                        (Point *                thePoint,
  1360.                                  WindowPtr *            window);
  1361.  
  1362. EXTERN_API_C( void )
  1363. getwtitle                        (WindowPtr                 window,
  1364.                                  char *                    title);
  1365.  
  1366. EXTERN_API_C( long )
  1367. growwindow                        (WindowPtr                 window,
  1368.                                  Point *                startPt,
  1369.                                  const Rect *            bBox);
  1370.  
  1371. EXTERN_API_C( WindowPtr )
  1372. newwindow                        (void *                    wStorage,
  1373.                                  const Rect *            boundsRect,
  1374.                                  const char *            title,
  1375.                                  Boolean                 visible,
  1376.                                  short                     theProc,
  1377.                                  WindowPtr                 behind,
  1378.                                  Boolean                 goAwayFlag,
  1379.                                  long                     refCon);
  1380.  
  1381. EXTERN_API_C( WindowPtr )
  1382. newcwindow                        (void *                    wStorage,
  1383.                                  const Rect *            boundsRect,
  1384.                                  const char *            title,
  1385.                                  Boolean                 visible,
  1386.                                  short                     procID,
  1387.                                  WindowPtr                 behind,
  1388.                                  Boolean                 goAwayFlag,
  1389.                                  long                     refCon);
  1390.  
  1391. EXTERN_API_C( long )
  1392. pinrect                            (const Rect *            theRect,
  1393.                                  Point *                thePt);
  1394.  
  1395. EXTERN_API_C( Boolean )
  1396. trackbox                        (WindowPtr                 window,
  1397.                                  Point *                thePt,
  1398.                                  short                     partCode);
  1399.  
  1400. EXTERN_API_C( long )
  1401. draggrayrgn                        (RgnHandle                 theRgn,
  1402.                                  Point *                startPt,
  1403.                                  const Rect *            boundsRect,
  1404.                                  const Rect *            slopRect,
  1405.                                  short                     axis,
  1406.                                  DragGrayRgnUPP         actionProc);
  1407.  
  1408. EXTERN_API_C( void )
  1409. dragwindow                        (WindowPtr                 window,
  1410.                                  Point *                startPt,
  1411.                                  const Rect *            boundsRect);
  1412.  
  1413. #endif  /* CGLUESUPPORTED */
  1414.  
  1415. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1416. /* • WindowRecord accessor macros                                                        */
  1417. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1418. /*
  1419.     *****************************************************************************
  1420.     *                                                                           *
  1421.     * The conditional STRICT_WINDOWS has been removed from this interface file. *
  1422.     * The accessor macros to a WindowRecord are no longer necessary.            *
  1423.     *                                                                           *
  1424.     * All ≈Ref Types have reverted to their original Handle and Ptr Types.      *
  1425.     *                                                                           *
  1426.     *****************************************************************************
  1427.  
  1428.     Details:
  1429.     The original purpose of the STRICT_ conditionals and accessor macros was to
  1430.     help ease the transition to Copland.  Shared data structures are difficult
  1431.     to coordinate in a preemptive multitasking OS.  By hiding the fields in a
  1432.     WindowRecord and other data structures, we would begin the migration to the
  1433.     discipline wherein system data structures are completely hidden from
  1434.     applications.
  1435.     
  1436.     After many design reviews, we finally concluded that with this sort of
  1437.     migration, the system could never tell when an application was no longer
  1438.     peeking at a WindowRecord, and thus the data structure might never become
  1439.     system owned.  Additionally, there were many other limitations in the
  1440.     classic toolbox that were begging to be addressed.  The final decision was
  1441.     to leave the traditional toolbox as a compatibility mode.
  1442.     
  1443.     We also decided to use the Handle and Ptr based types in the function
  1444.     declarations.  For example, NewWindow now returns a WindowPtr rather than a
  1445.     WindowRef.  The Ref types are still defined in the header files, so all
  1446.     existing code will still compile exactly as it did before.  There are
  1447.     several reasons why we chose to do this:
  1448.     
  1449.     - The importance of backwards compatibility makes it unfeasible for us to
  1450.     enforce real opaque references in the implementation anytime in the
  1451.     foreseeable future.  Therefore, any opaque data types (e.g. WindowRef,
  1452.     ControlRef, etc.) in the documentation and header files would always be a
  1453.     fake veneer of opacity.
  1454.     
  1455.     - There exists a significant base of books and sample code that neophyte
  1456.     Macintosh developers use to learn how to program the Macintosh.  These
  1457.     books and sample code all use direct data access.  Introducing opaque data
  1458.     types at this point would confuse neophyte programmers more than it would
  1459.     help them.
  1460.     
  1461.     - Direct data structure access is used by nearly all Macintosh developers. 
  1462.     Changing the interfaces to reflect a false opacity would not provide any
  1463.     benefit to these developers.
  1464.     
  1465.     - Accessor functions are useful in and of themselves as convenience
  1466.     functions.
  1467.     
  1468.     - Note: some accessor names conflict with API's in Win32 and have been renamed
  1469.     to have a Mac prefix (QuickTime 3.0).
  1470. */
  1471. #ifdef __cplusplus
  1472. inline CGrafPtr        GetWindowPort(WindowPtr w)                     { return (CGrafPtr) w;                                                     }
  1473. inline void            SetPortWindowPort(WindowPtr w)                { MacSetPort( (GrafPtr) GetWindowPort(w)); }
  1474. inline SInt16        GetWindowKind(WindowPtr w)                     { return ( *(SInt16 *)    (((UInt8 *) w) + sizeof(GrafPort)));             }
  1475. inline void            SetWindowKind(WindowPtr    w, SInt16 wKind)    { *(SInt16 *)    (((UInt8 *) w) + sizeof(GrafPort)) = wKind;              }
  1476. #if TARGET_OS_MAC
  1477. inline Boolean        IsWindowVisible(WindowPtr w)                { return *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x2);         }
  1478. #endif
  1479. inline Boolean        MacIsWindowVisible(WindowPtr w)                { return *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x2);         }
  1480. inline Boolean        IsWindowHilited(WindowPtr w)                { return *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x3);        }
  1481. inline Boolean        GetWindowGoAwayFlag(WindowPtr w)            { return *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x4);        }
  1482. inline Boolean        GetWindowZoomFlag(WindowPtr w)                { return *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x5);        }
  1483. inline void            GetWindowStructureRgn(WindowPtr w, RgnHandle r)    { MacCopyRgn( *(RgnHandle *)(((UInt8 *) w) + sizeof(GrafPort) + 0x6), r );    }
  1484. inline void            GetWindowContentRgn(WindowPtr w, RgnHandle r)    { MacCopyRgn( *(RgnHandle *)(((UInt8 *) w) + sizeof(GrafPort) + 0xA), r );    }
  1485. inline void            GetWindowUpdateRgn(WindowPtr w, RgnHandle r)    { MacCopyRgn( *(RgnHandle *)(((UInt8 *) w) + sizeof(GrafPort) + 0xE), r );    }
  1486. inline SInt16        GetWindowTitleWidth(WindowPtr w)                { return *(SInt16 *)(((UInt8 *) w) + sizeof(GrafPort) + 0x1E);            }
  1487. #if TARGET_OS_MAC
  1488. inline WindowPtr    GetNextWindow(WindowPtr w)                        { return *(WindowPtr *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x24);        }
  1489. #endif
  1490. inline WindowPtr    MacGetNextWindow(WindowPtr w)                    { return *(WindowPtr *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x24);        }
  1491.  
  1492. inline void    GetWindowStandardState(WindowPtr w, Rect *r)
  1493. {    Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));
  1494. if (stateRects != NULL)    *r = stateRects[1];        }
  1495. inline void    SetWindowStandardState(WindowPtr w, const Rect *r)
  1496. {     Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));
  1497.     if (stateRects != NULL)    stateRects[1] = *r;     }
  1498. inline void    GetWindowUserState(WindowPtr w, Rect *r)
  1499. {     Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));
  1500.     if (stateRects != NULL)    *r = stateRects[0]; }
  1501. inline void    SetWindowUserState(WindowPtr w, const Rect *r)
  1502. { Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));
  1503.     if (stateRects != NULL)    stateRects[0] = *r; }
  1504. inline Handle        GetWindowDataHandle(WindowPtr w)                {    return    (((WindowPeek) (w))->dataHandle);                }
  1505. inline void            SetWindowDataHandle(WindowPtr w, Handle data)    {    (((WindowPeek) (w))->dataHandle) = ((Handle) (data));    }
  1506. #else
  1507. #if TARGET_OS_MAC
  1508. #define IsWindowVisible MacIsWindowVisible
  1509. #define GetNextWindow MacGetNextWindow
  1510. #endif
  1511. #define ShowHideWindow(w)                        ShowHide(w)
  1512. #define SetPortWindowPort(w)                    MacSetPort( (GrafPtr) GetWindowPort(w) )
  1513. #define GetWindowPort(w)                        ( (CGrafPtr) w)
  1514. #define GetWindowKind(w)                        ( *(SInt16 *)    (((UInt8 *) w) + sizeof(GrafPort)))
  1515. #define SetWindowKind(w, wKind)                    ( *(SInt16 *)    (((UInt8 *) w) + sizeof(GrafPort)) = wKind )
  1516. #define MacIsWindowVisible(w)                    ( *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x2))
  1517. #define IsWindowHilited(w)                        ( *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x3))
  1518. #define GetWindowGoAwayFlag(w)                    ( *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x4))
  1519. #define GetWindowZoomFlag(w)                    ( *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x5))
  1520. #define GetWindowStructureRgn(w, aRgnHandle)    MacCopyRgn( *(RgnHandle *)(((UInt8 *) w) + sizeof(GrafPort) + 0x6), aRgnHandle )
  1521. #define GetWindowContentRgn(w, aRgnHandle)        MacCopyRgn( *(RgnHandle *)(((UInt8 *) w) + sizeof(GrafPort) + 0xA), aRgnHandle )
  1522.  
  1523. #define GetWindowUpdateRgn(w, aRgnHandle)        MacCopyRgn( *(RgnHandle *)(((UInt8 *) w) + sizeof(GrafPort) + 0xE), aRgnHandle )
  1524.  
  1525. #define GetWindowTitleWidth(w)                    ( *(SInt16 *)        (((UInt8 *) w) + sizeof(GrafPort) + 0x1E))
  1526. #define MacGetNextWindow(w)                        ( *(WindowPtr *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x24))
  1527.  
  1528. #define GetWindowStandardState(w, aRectPtr)    do { Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));    \
  1529.                                                                 if (stateRects != NULL)    *aRectPtr = stateRects[1]; } while (false)
  1530. #define SetWindowStandardState(w, aRectPtr)    do { Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));    \
  1531.                                                                 if (stateRects != NULL)    stateRects[1] = *aRectPtr; } while (false)
  1532. #define GetWindowUserState(w, aRectPtr)        do { Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));    \
  1533.                                                                 if (stateRects != NULL)    *aRectPtr = stateRects[0]; } while (false)
  1534. #define SetWindowUserState(w, aRectPtr)        do { Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));    \
  1535.                                                                 if (stateRects != NULL)    stateRects[0] = *aRectPtr; } while (false)
  1536. #define GetWindowDataHandle(windowRef)                (((WindowPeek) (windowRef))->dataHandle)
  1537. #define SetWindowDataHandle(windowRef, data)        (((WindowPeek) (windowRef))->dataHandle) = ((Handle) (data))
  1538.  
  1539. #endif  /* defined(__cplusplus) */
  1540.  
  1541.  
  1542.  
  1543.  
  1544.  
  1545.  
  1546.  
  1547.  
  1548.  
  1549. #if PRAGMA_STRUCT_ALIGN
  1550.     #pragma options align=reset
  1551. #elif PRAGMA_STRUCT_PACKPUSH
  1552.     #pragma pack(pop)
  1553. #elif PRAGMA_STRUCT_PACK
  1554.     #pragma pack()
  1555. #endif
  1556.  
  1557. #ifdef PRAGMA_IMPORT_OFF
  1558. #pragma import off
  1559. #elif PRAGMA_IMPORT
  1560. #pragma import reset
  1561. #endif
  1562.  
  1563. #ifdef __cplusplus
  1564. }
  1565. #endif
  1566.  
  1567. #endif /* __MACWINDOWS__ */
  1568.  
  1569.